<template>
	<view class="wodefapiao">
		<view class="wodefapiao-head">
			<view class="wodefapiao-head_left">发票管理</view>
			<view class="wodefapiao-head_btn" @click="toApplyFapiao">申请发票</view>
		</view>
		<view class="wodefapiao-body" v-if="fapiaoList.length">
			<!-- 已开发票 -->
			<view class="wodefapiao-box" v-for="(item,index) in fapiaoList" >
				<view class="wodefapiao-cell">
					<view class="wodefapiao-cell_name">{{item.taitou}}</view>
					<view class="wodefapiao-cell-statu" v-if="item.tag == 3">
						<view class="statu-bohui">申请驳回</view>
					</view>
					<view class="wodefapiao-cell-statu" v-if="item.tag == 1">
						<view class="statu-bohui2">申请中</view>
					</view>
				</view>
				<view class="wodefapiao-cell">
					<view class="wodefapiao-cell_left">发票类型：</view>
					<view class="wodefapiao-cell_right">
						{{item.fplx}}
					</view>
				</view>
				<view class="wodefapiao-cell">
					<view class="wodefapiao-cell_left">接收邮箱：</view>
					<view class="wodefapiao-cell_right">
						{{item.email}}
					</view>
				</view>
				<view class="wodefapiao-cell">
					<view class="wodefapiao-cell_left">发票金额：</view>
					<view class="wodefapiao-cell_right">
						￥{{item.money}}
					</view>
				</view>
				<view class="wodefapiao-cell">
					<view class="wodefapiao-cell_left">申请时间：</view>
					<view class="wodefapiao-cell_right">
						{{item.sqrq}}
					</view>
				</view>
				<view class="wodefapiao-cell-foot">
					<view class="chakan-btn foot-btn" @click="checkBtn(item)">查看</view>
				</view>
			</view>
			

		</view>
		<!-- 发票为空  v-else-->
		<view class="wodefapiao-null" v-else>
			<image src="@/static/img/wodefapiao/fapiao-null.png" class="wodefapiao-null-img"></image>
			<view class="wodefapiao-null-text">您没有申请中的发票，请先<text style="color: #2F7FFF;" @click="toApplyFapiao">申请发票</text></view>
		</view>
	</view>
</template>

<script>
	import commonjs from '@/common/script/common.js';
	export default {
		data() {
			return {
				list: [],
				location: 11042,
				fapiaoList: [],
			}
		},

		onLoad() {
			this.fapiao();
		},

		onShow() {

		},

		methods: {
			// 发票列表
			fapiao() {
				uni.$u.http
					.post('User/fapiao/FapiaoListHandler.ashx', {
						location: this.location,
						tags: "1,3",
					}).then((rs) => {
						this.fapiaoList = rs.list;
					})
			},

			checkBtn(item) {
				uni.navigateTo({
					url: '/pages/user/wodefapiao/chakanfapiao?fapiaoid=' + item.id + "&tag=" + item.tag
				})
			},
			// editFapiao(item) {
			// 	uni.navigateTo({
			// 		url: '/pages/user/wodefapiao/shenqingfapiao?id=' + item.id
			// 	})
			// },
			toApplyFapiao(){
				uni.navigateTo({
					url: '/pages/user/wodefapiao/shenqingfapiao'
				})
			}
		}
	}
</script>

<style lang="scss">
	@import "@/static/css/fapiao.scss";
	page {
		height: 100%;
	}

	.wodefapiao {
		background-color: rgb(244, 244, 244);
		width: 100%;
		// height: 100%;
		display: flex;
		flex-direction: column;
	}
</style>